package com.youku.utils
{
   public class DependenceChecker extends Object
   {
      
      public function DependenceChecker() {
         super();
         this._dependences = [];
      }
      
      private var _dependences:Array;
      
      public function addDependence(param1:Object) : void {
         var _loc2_:* = 0;
         _loc2_ = 0;
         while(_loc2_ < this._dependences.length)
         {
            if((this._dependences[_loc2_] as DependenceChecker).obj == param1)
            {
               break;
            }
            _loc2_++;
         }
         var _loc3_:Dependence = new Dependence();
         _loc3_.obj = param1;
         _loc3_.status = false;
         if(_loc2_ >= this._dependences.length)
         {
            this._dependences.push(_loc3_);
         }
         else
         {
            this._dependences[_loc2_] = _loc3_;
         }
      }
      
      public function removeDependence(param1:Object) : void {
         var _loc2_:* = 0;
         _loc2_ = 0;
         while(_loc2_ < this._dependences.length)
         {
            if((this._dependences[_loc2_] as DependenceChecker).obj == param1)
            {
               (this._dependences[_loc2_] as DependenceChecker).status = true;
            }
            _loc2_++;
         }
      }
      
      public function check() : Boolean {
         var _loc1_:* = true;
         var _loc2_:* = 0;
         while(_loc2_ < this._dependences.length)
         {
            if((this._dependences[_loc2_] as DependenceChecker).status == false)
            {
               _loc1_ = false;
            }
            _loc2_++;
         }
         return _loc1_;
      }
   }
}
class Dependence extends Object
{
   
   function Dependence() {
      super();
   }
   
   public var obj:Object;
   
   public var status:Boolean = true;
}
